package com.javasm.crm.controller.aftersale;


import com.javasm.crm.common.http.AxiosResult;
import com.javasm.crm.controller.base.BaseController;
import com.javasm.crm.domin.entity.aftersale.RefacInGoods;
import com.javasm.crm.domin.entity.aftersale.RefacOutGoods;
import com.javasm.crm.service.aftersale.IRefacInGoodsService;
import com.javasm.crm.service.aftersale.IRefacOutGoodsService;
import com.javasm.crm.utils.transfer.OutGoodToInGoodTransfer;
import io.swagger.annotations.ApiOperation;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;
import java.util.List;

/**
 * <p>
 *  前端控制器
 * </p>
 *
 * @author lirui
 * @since 2021-07-11
 */
@RestController
@RequestMapping("/crm/refacingoods")
public class RefacInGoodsController extends BaseController {

    @Resource
    private IRefacOutGoodsService outGoodsService;

    @Resource
    private IRefacInGoodsService inGoodsService;

    @Resource
    private OutGoodToInGoodTransfer transfer;

    @GetMapping("getGoods")
    @ApiOperation(value = "出库申请单id", notes = "根据出库申请单id获得商品，商品信息来源出库申请单商品表，并将类型转换为入库申请单商品表")
    private AxiosResult getInGoodWithInApplyId(Integer id){

        List<RefacInGoods> inGoodsList =inGoodsService.getInGoodWithInApplyId(id);

        if (inGoodsList.size() == 0)
            return AxiosResult.success();


        return AxiosResult.success(inGoodsList);
    }
}
